<template>
	<view>
		<headerNav :navRightIcon="false" leftIconColor="#fff" title="加入" title-color="#ffffff">
			<view class="flex justify-between w-full">
				<view class="w-120"></view>
				<view class="flex-1 flex items-center justify-center">
					<tabNav :tabList="tabList" :selectIndex.sync="selectIndex" @handleClick="handleTabSwitch" :center="true"></tabNav>
				</view>
				<view class="w-120"></view>
			</view>
		</headerNav>
		<view  class="shang_city">
			<view v-if="pan_status==1">
				<view style="position: relative;width: 100%;box-sizing: border-box;margin: 30rpx auto;z-index: 999" v-if="false">
					<input type="text"   class="sou" placeholder-class="suo" v-model="keywords"
						placeholder="电话号/用户名" confirm-type="search" @confirm="ren_search" />
					<image src="https://dyeego.oss-cn-beijing.aliyuncs.com/uploads/20220325/91243acc628efa1338d3d38826d22484.png"
						class="souicon" mode=""></image>
				</view>
				<view class="flex items-center">
					<view style="position: relative;box-sizing: border-box;margin: 30rpx auto;" class="flex-1">
						<input type="text"   class="sou" placeholder-class="suo" v-model="keywords"
						placeholder="电话号/用户名" confirm-type="search" @confirm="ren_search" />
						<image src="https://dyeego.oss-cn-beijing.aliyuncs.com/uploads/20220325/91243acc628efa1338d3d38826d22484.png"
						class="souicon" mode=""></image>
					</view>
					<view @click="chuangjian" class="jian relative_1">
						创建群聊
					</view>
				</view>

				<view v-if="!seach_type" class="relative_1">
					<view style="margin-top: 20rpx;background-color: #FFFFFF;box-sizing: border-box;padding:0 30rpx 10rpx 30rpx;border-radius: 16rpx;">
						<view style="line-height: 32rpx;color: #000;font-size: 28rpx;padding: 30rpx 0 32rpx 0">
							关注我的人
						</view>
						<view class="flex" style="overflow: hidden;margin-bottom: 30rpx;position: relative;" v-for="(item,index) in list" :key='index'>
							<view @click="yhxx(item.user_id)" style="float: left;width: 100rpx;overflow: hidden;margin: 0 20rpx 0 0;">
								<image :src="item.user.avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;display: block;float: left;" mode=""></image>
							</view>
							<view style="width: calc(100% - 110rpx)">
								<view class="flex justify-between" style="width: 100%">
									<view class="">
										<view style="color: #000000;font-size: 30rpx;font-weight: 600;line-height: 32rpx;" class="yihang">
											{{item.user.name || ''}}
										</view>
										<view style="color: #666;font-size: 24rpx;line-height: 28rpx;margin-top: 12rpx" class="yihang">
											{{item.user.company || '暂无公司'}}
										</view>
									</view>
									<view>
										<view @click="huiguan(item.user_id,index,1)" class="yichu1" style="margin-left: 10rpx;">
											回关
										</view>
										<view @click="yichu_new(item.id,index)" class="yichu">
											移除
										</view>
									</view>
								</view>
								<view style="font-size: 24rpx;line-height: 28rpx;" class="yihang">
									<text class="" style="color: #000">
										{{item.create_time_text || ''}}
									</text>
									<text class="pl10" style="color: #18A9A5">
										关注了你
									</text>
								</view>
							</view>


						</view>
						<view style="text-align: center;margin-top: 20rpx;">
							<image v-if="list.length==0" :src="require('@/static/my/no-data.png')" style="width: 334rpx;"  mode="widthFix"></image>
							<!-- <view style="width: 80%;margin: 0 auto;">
								<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="暂无数据" v-if="list.length==0"></u-divider>
								<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="没有更多了" v-if="list.length>0 && enmpy"></u-divider>
							</view> -->
						</view>
						<view class="flex items-center justify-center" v-if="!enmpy" @click="new_more" style="width: 100%;text-align: center;color: #999999;font-size: 24rpx;">
							<view class="pr10">
								查看更多
							</view>
							<u-icon name="arrow-down" size="16"></u-icon>
						</view>
					</view>
					<view style="margin-top: 20rpx;background-color: #FFFFFF;box-sizing: border-box;padding:10rpx 30rpx;border-radius: 16rpx;">
						<view style="line-height: 100rpx;color: #000000;font-size: 28rpx;">
							可能想认识的人
						</view>
						<view style="overflow: hidden;margin-bottom: 30rpx;position: relative;" v-for="(item,index) in keneng_list" :key='index'>
							<view @click="yhxx(item.user_id)" style="float: left;width: 23%;overflow: hidden;">
								<image :src="item.client.avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;display: block;float: left;margin-top: 6rpx;" mode=""></image>
							</view>
							<view style="width: 50%;float: left;padding: 10rpx 0;">
								<view style="color: #000000;font-size: 30rpx;font-weight: 600;line-height: 50rpx;" class="yihang">
									{{item.client.name || ''}}
								</view>
								<view style="color: #999999;font-size: 24rpx;line-height: 50rpx;" class="yihang">
									{{item.client.company || '暂无公司'}}
								</view>
							</view>
							<view @click="huiguan(item.client.id,index,2)" class="yichu2">
								关注
							</view>

						</view>
						<view style="text-align: center;margin-top: 20rpx;">
							<image v-if="keneng_list.length==0" :src="require('@/static/my/no-data.png')" style="width: 334rpx;"  mode="widthFix"></image>
							<!-- <view style="width: 80%;margin: 0 auto;">
								<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="没有更多了" v-if="keneng_list.length==0"></u-divider>
							</view> -->
						</view>
					</view>
				</view>
				<view v-if="seach_type">
					<view v-for="(item,index) in list1" :key='index'>
						<view v-if="item.attention_check==1" style="overflow: hidden;margin-bottom: 30rpx;position: relative;">
							<view @click="yhxx(item.id)" style="float: left;width: 23%;overflow: hidden;">
								<image :src="item.avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;display: block;float: left;margin-top: 6rpx;" mode=""></image>
							</view>
							<view style="width: 50%;float: left;padding: 10rpx 0;">
								<view style="color: #000000;font-size: 30rpx;font-weight: 600;line-height: 50rpx;" class="yihang">
									{{item.name || ''}}
								</view>
								<view style="color: #999999;font-size: 24rpx;line-height: 50rpx;" class="yihang">
									{{item.company || '暂无公司'}}
								</view>
							</view>
							<view @click="huiguan1(item.id,index,1)" class="yichu2">
								回关
							</view>

						</view>
						<view v-if="item.attention_check==2" style="overflow: hidden;margin-bottom: 30rpx;position: relative;" >
							<view @click="yhxx(item.id)" style="float: left;width: 23%;overflow: hidden;">
								<image :src="item.avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;display: block;float: left;margin-top: 6rpx;" mode=""></image>
							</view>
							<view style="width: 50%;float: left;padding: 10rpx 0;">
								<view style="color: #000000;font-size: 30rpx;font-weight: 600;line-height: 50rpx;" class="yihang">
									{{item.name || ''}}
								</view>
								<view style="color: #999999;font-size: 24rpx;line-height: 50rpx;" class="yihang">
									{{item.company || '暂无公司'}}
								</view>
							</view>
							<view @click="huiguan1(item.id,index,2)" class="yichu2">
								关注
							</view>

						</view>
					</view>
					<view style="text-align: center;margin-top: 20rpx;">
						<image v-if="list1.length==0" :src="require('@/static/my/no-data.png')" style="width: 334rpx;"  mode="widthFix"></image>
						<view style="width: 80%;margin: 0 auto;">
							<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="暂无数据" v-if="list1.length==0"></u-divider>
							<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="没有更多了" v-if="list1.length>0 && enmpy1"></u-divider>
						</view>
					</view>
				</view>

			</view>

			<view v-if="pan_status==2">
				<view class="flex items-center">
					<view style="position: relative;box-sizing: border-box;margin: 30rpx auto;" class="flex-1">
						<input type="text"   class="sou" placeholder-class="suo" v-model="keywords"
						placeholder="搜索群名称" confirm-type="search" @confirm="qun_search" />
						<image src="https://dyeego.oss-cn-beijing.aliyuncs.com/uploads/20220325/91243acc628efa1338d3d38826d22484.png"
						class="souicon" mode=""></image>
					</view>
					<view @click="chuangjian" class="jian relative_1">
						创建群聊
					</view>
				</view>

				<scroll-view id="tab-bar" class="scroll-h3" :scroll-x="true"
					:show-scrollbar="false" :scroll-into-view="scrollinfo">
					<view class="flex items-center" hover-class="none" hover-stop-propagation="false">
						<view @click="tj_jtb_qh(index,item.id)" v-for="(item,index) in tj_pp_list" :key='index' :id="item.ids"  :class="['uni-tab-item3',item.check?'jtb_active':'jtb_as']">
							<view style="overflow: hidden;position: relative;">
								<image :src="item.logo_image" style="width: 84rpx;height: 84rpx;"
									mode="aspectFill"></image>
							</view>
							<view style="font-size: 24rpx;line-height: 40rpx;height: 40rpx;text-align: center;margin-top: 10rpx;" class="yihang">
								{{item.name || ''}}
							</view>
						</view>
					</view>
				</scroll-view>
				<view style="margin: 30rpx auto;width: 100%;">
					<scroll-view v-if="erji_list.length!=0" :enable-flex="true" scroll-with-animation :throttle="false" scroll-x :scroll-into-view="scrollinfo1">
						<view class="nav2 uni-nav" style="padding: 0;">
							<view class="nav-item2" :class="item.check? 'nav-item-act2' : ''" :key="index"
								v-for="(item, index) in erji_list" :id='item.ids' @click="qie_name(index,item.id)">
								{{ item.name }}
							</view>
							<!-- <view class="nav-line" :style="style"></view> -->

						</view>

					</scroll-view>
				</view>
				<view style="background-color: #FFFFFF;box-sizing: border-box;padding:40rpx 0 10rpx 30rpx;border-radius: 16rpx;">
					<view style="overflow: hidden;margin-bottom: 30rpx;position: relative;" v-for="(item,index) in list2" :key='index'>
						<view @click="qun_jia(item.is_join,item.group_id)" style="float: left;width: 23%;overflow: hidden;">
							<image :src="item.avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;display: block;float: left;margin-top: 6rpx;" mode=""></image>
						</view>
						<view style="width: 77%;float: left;padding: 10rpx 180rpx 10rpx 0;box-sizing: border-box;border-bottom: 1px solid #f5f5f5;">
							<view style="overflow: hidden;font-size: 30rpx;font-weight: 600;line-height: 50rpx;">
								<text style="color: #000000;display: inline-block;max-width: 74%;float: left;" class="yihang">
									{{item.name || ''}}
								</text>
								<text style="float: left;margin-left: 10rpx;font-size: 26rpx;">({{item.join_num || ''}})</text>
							</view>
							<view style="color: #999999;font-size: 24rpx;line-height: 50rpx;" class="yihang">
								{{item.introduction || ''}}
							</view>
						</view>
						<view v-if="item.is_join!=1" @click="jiaqun(index)" class="yichu3">
							加入
						</view>
						<view v-if="item.is_join==1" class="yichu3" style="background-color: #666;">
							已加入
						</view>
					</view>
					<view style="text-align: center;margin-top: 20rpx;">
						<image v-if="list2.length==0" :src="require('@/static/my/no-data.png')" style="width: 334rpx;"  mode="widthFix"></image>
						<!-- <view style="width: 80%;margin: 0 auto;">
							<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="暂无数据" v-if="list2.length==0"></u-divider>
							<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="没有更多了" v-if="list2.length>0 && enmpy2"></u-divider>
						</view> -->
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import isAuditIos from '@/common/isAuditIos.js'
	export default{
		mixins: [isAuditIos],
		data(){
			return{
				tabList: [
					{text: '找人', type: 'people',index: 0},
					{text: '找群', type: 'group',index: 1}
				],
    		selectIndex: 1,
				scrollTop: 0,
				navheight: 0,
				statusBarHeight: 0,
				menuHeight: 0,
				haveBack: false,
				btnHeight: 30,
				btnWidth: 70,
				isScroll:true,
				slotheight:'0',
				xiao:true,

				pan_status:1,
				scrollinfo:'',
				tj_pp_list:[],

				scrollinfo1:'',
				erji_list:[],
				id:0,



				keywords:'',
				new_friend:0,
				page:1,
				list:[],
				enmpy:false,
				kk:false,

				keneng_list:[],


				page1:1,
				list1:[],
				enmpy1:false,
				kk1:false,

				seach_type:false,
				category_id:'',
				category_id2:'',
				page2:1,
				list2:[],
				enmpy2:false,
				kk2:false,
				bgcolor: 'transparent',
				toolcolor: 'transparent',
			}
		},
		onLoad(option) {
			if(option.index){
				this.pan_status = option.index
				this.selectIndex = +option.index
			}else{
				this.pan_status=1
			}
			this.xuanze()
			this.erji(this.id)
		},
		onShow() {
			if(this.pan_status==1){
				this.page=1
				this.enmpy=false
				this.kk=false
				this.list=[]
				this.ren_new()
				this.keneng()
			}else{
				this.page2=1
				this.enmpy2=false
				this.kk2=false
				this.list2=[]
				this.qun()
			}

		},
		onReachBottom: function() {
			if(this.pan_status==1 && this.keywords!=''){
				if (this.enmpy1) {
					return
				} else {
					this.xiaci()
				}
			}
			if(this.pan_status==2){
				if (this.enmpy2) {
					return
				} else {
					this.qun()
				}
			}
		},
		methods:{
			qun_jia:function(index,id){
				if(index!=1){
					uni.navigateTo({
						url:"/sub/pages/wei_qunxiaoxi?id="+id
					})
				}else{
					uni.navigateTo({
						url:"/sub/pages/jia_qunxiaoxi?id="+id
					})
				}
			},
			yhxx:function(id){
				uni.navigateTo({
					url:'/fenbao/pages/wenzhang/yhxx?id='+id
				})
			},
			// 加群
			jiaqun:function(index){
				let that=this
				this.post('api/client/info', '', true).then(res => {
					console.log(res)
					if (res.code == 1) {
						that.post('api/im/im/check_group',{group_id:that.list2[index].group_id},true).then(re=>{
							if(re.code==1){
								uni.navigateTo({
									url:'/sub/pages/jr_shenqing?avatar='+that.list2[index].avatar+'&name='+that.list2[index].name+'&jieshao='+that.list2[index].introduction+'&id='+that.list2[index].group_id
								})
							}else if(re.code==211){
								if (that.iosUpAppStore) {
									uni.showModal({
										title: '提示',
										content: re.msg,
										success: function(res1) {
											if (res1.confirm) {
												uni.navigateTo({
													url: '../../subpages/pages/vip'
												})
											} else if (res1.cancel) {

											}
										}
									});
								}
							}else{
								uni.showToast({
									title: re.msg,
									icon: "none",
									duration: 1000
								})
							}
						})
						return
						if(res.data.is_vip==1){
							uni.navigateTo({
								url:'/sub/pages/jr_shenqing?avatar='+this.list2[index].avatar+'&name='+this.list2[index].name+'&jieshao='+this.list2[index].introduction+'&id='+this.list2[index].group_id
							})
						}else if(res.data.is_vip==2){
							uni.showModal({
								title: '提示',
								content: '您的会员已到期,只有会员才可以加群,请前去续费会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						}else if(res.data.is_vip==0){
							uni.showModal({
								title: '提示',
								content: '只有会员才可以加群,请前去开通会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						}
					}
				})

			},

			// 找群
			qun:function(){
				this.post('api/im/im/add_search_group',{page:this.page2,limit:10,keywords:this.keywords,category_id:this.category_id,category_id2:this.category_id2},true).then(res=>{
					if(res.code==1){
						if(this.page2==1){
							if (res.data.data== null || res.data.data.length == 0) {
								this.kk2 = true
								this.enmpy2 = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy2 = true
							}
						}else{
							if (res.data.data== null || res.data.data.length == 0) {
								this.enmpy2 = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy2 = true
							}
						}

						this.page2++
						this.list2.push(...res.data.data)
					}else{
						this.kk2 = true
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},


			// 找人
			// 新朋友
			ren_new:function(){
				this.post('api/im/im/add_search_contact_new',{page:this.page,limit:10},true).then(res=>{
					if(res.code==1){
						if(this.page==1){
							if (res.data.data== null || res.data.data.length == 0) {
								this.kk = true
								this.enmpy = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy = true
							}
						}else{
							if (res.data.data== null || res.data.data.length == 0) {
								this.enmpy = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy = true
							}
						}

						this.page++
						this.list.push(...res.data.data)
					}else{
						this.kk = true
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},
			new_more:function(){
				this.ren_new()
			},

			// 可能认识的人
			keneng:function(){
				this.post('api/im/im/add_search_contact_maybe','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						this.keneng_list=res.data
					}
				})
			},
			// 移除新朋友
			yichu_new:function(id,index){
				let that=this
				uni.showModal({
					title: '提示',
					content: '您确定移除该用户？',
					success: function (res) {
						if (res.confirm) {
							that.post('api/im/im/remove_attention',{new_friend_id:id},true).then(res=>{
								console.log(res)
								if(res.code==1){
									uni.showToast({
										title: res.msg,
										icon: "none",
										duration: 1000
									})
									that.list.splice(index,1)
								}else{
									uni.showToast({
										title: res.msg,
										icon: "none",
										duration: 1000
									})
								}
							})
						} else if (res.cancel) {

						}
					}
				});

			},
			huiguan:function(id,index,type){
				let that=this
				this.post('api/client/attention_client',{client_id:id},true).then(res=>{
					if(res.code==1){
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
						if(type==1){
							that.list.splice(index,1)
						}else{
							that.keneng_list.splice(index,1)
						}
					}else{
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},
			huiguan1:function(id,index,type){
				let that=this
				this.post('api/client/attention_client',{client_id:id},true).then(res=>{
					if(res.code==1){
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
						that.list1.splice(index,1)
					}else{
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},
			// 搜索找人
			ren_search:function(){
				if(this.keywords==''){
					this.seach_type=false
					this.page=1
					this.enmpy=false
					this.kk=false
					this.list=[]
					this.ren_new()
					this.keneng()
					return
				}
				this.seach_type=true
				this.page1=1
				this.enmpy1=false
				this.kk1=false
				this.list1=[]
				this.post('api/im/im/add_search_contact',{keywords:this.keywords,page:this.page1,limit:10},true).then(res=>{
					if(res.code==1){
						if(this.page==1){
							if (res.data.data== null || res.data.data.length == 0) {
								this.kk1 = true
								this.enmpy1 = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy1 = true
							}
						}else{
							if (res.data.data== null || res.data.data.length == 0) {
								this.enmpy1 = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy1 = true
							}
						}

						this.page1++
						this.list1.push(...res.data.data)
					}else{
						this.kk1 = true
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},

			xiaci:function(){
				this.post('api/im/im/add_search_contact',{keywords:this.keywords,page:this.page1,limit:10},true).then(res=>{
					if(res.code==1){
						if(this.page==1){
							if (res.data.data== null || res.data.data.length == 0) {
								this.kk1 = true
								this.enmpy1 = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy1 = true
							}
						}else{
							if (res.data.data== null || res.data.data.length == 0) {
								this.enmpy1 = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy1 = true
							}
						}

						this.page1++
						this.list1.push(...res.data.data)
					}else{
						this.kk1 = true
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},




			getTool:function(){
				uni.navigateBack({
					delta:1
				})
			},
			chuangjian:function(){
				let that=this
				that.post('api/im/im/check_group',{group_id:''},true).then(re=>{
					if(re.code==1){
						uni.navigateTo({
							url:'/sub/pages/tj_qunliao'
						})
					}else if(re.code==211){
						if (that.iosUpAppStore) {
							uni.showModal({
								title: '提示',
								content: re.msg,
								success: function(res1) {
									if (res1.confirm) {
											uni.navigateTo({
												url: '../../subpages/pages/vip'
											})

									} else if (res1.cancel) {

									}
								}
							});
						} else {
							uni.navigateTo({
								url:'/sub/pages/tj_qunliao'
							})
						}
					}else{
						uni.showToast({
							title: re.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
				return

				this.post('api/client/info', '', true).then(res => {
					console.log(res)
					if (res.code == 1) {
						if(res.data.is_vip==1){
							uni.navigateTo({
								url:'/sub/pages/tj_qunliao'
							})
						}else if(res.data.is_vip==2){
							uni.showModal({
								title: '提示',
								content: '您的会员已到期,只有会员才可以创建群聊,请前去续费会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						}else if(res.data.is_vip==0){
							uni.showModal({
								title: '提示',
								content: '只有会员才可以创建群聊,请前去开通会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						}
					}
				})

			},
			xuanze:function(){
				let quan=[
					{
						name:'全部',
						id:0,
						logo_image:'https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230413/8bfd4d306109650a72cdcc7741788c1b.png'
					}
				]
				this.post('api/index/category','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						this.tj_pp_list=quan.concat(res.data)
						for(let i=0;i<this.tj_pp_list.length;i++){
							if(i==0){
								this.tj_pp_list[i].check=true
							}else{
								this.tj_pp_list[i].check=false
							}
							this.tj_pp_list[i].ids='a'+i
						}
					}
				})
				console.log(this.tj_pp_list)
			},
			tj_jtb_qh:function(index,id){
				this.category_id=id
				for(let i=0;i<this.tj_pp_list.length;i++){
					if(index==i){
						this.tj_pp_list[i].check=true
						console.log(i)
					}else{
						this.tj_pp_list[i].check=false
					}
				}
				this.$forceUpdate()
				if(index==0){
					this.scrollinfo=this.tj_pp_list[0].ids
				}else{
					this.scrollinfo=this.tj_pp_list[index-1].ids
				}
				this.erji(id)
				this.category_id2=''
				this.page2=1
				this.enmpy2=false
				this.kk2=false
				this.list2=[]
				this.qun()
			},
			erji:function(id){
				let quan=[
					{
						name:'全部',
						id:0
					}
				]
				this.post('api/voice/manage2',{id:id},true).then(res=>{
					console.log(res)
					if(res.code==1){
						this.erji_list=quan.concat(res.data)
						for(let i=0;i<this.erji_list.length;i++){
							if(i==0){
								this.erji_list[i].check=true
							}else{
								this.erji_list[i].check=false
							}

							this.erji_list[i].ids='a'+i
						}
					}
				})
				// this.$forceUpdate()
			},
			qie_name:function(index,id){
				this.category_id2=id
				for(let i=0;i<this.erji_list.length;i++){
					if(index==i){
						this.erji_list[i].check=true
						console.log(i)
					}else{
						this.erji_list[i].check=false
					}
				}
				this.$forceUpdate()
				if(index==0){
					this.scrollinfo1=this.erji_list[0].ids
				}else{
					this.scrollinfo1=this.erji_list[index-1].ids
				}
				this.page2=1
				this.enmpy2=false
				this.kk2=false
				this.list2=[]
				this.qun()
			},
			qun_search:function(){
				this.page2=1
				this.enmpy2=false
				this.kk2=false
				this.list2=[]
				this.qun()
			},
			handleTabSwitch:function(index){
				this.pan_status=index
				this.keywords=''
				this.seach_type=false
				if(this.pan_status==1){
					this.page=1
					this.enmpy=false
					this.kk=false
					this.list=[]
					this.ren_new()
					this.keneng()
				}else{
					this.page2=1
					this.enmpy2=false
					this.kk2=false
					this.list2=[]
					this.qun()
				}
			},
			getSysHeightInfo() {
				const that = this
				let statusBarHeight, menuButtonObject, menuHeight, navheight, haveBack, btnHeight, btnWidth

				statusBarHeight = uni.getSystemInfoSync().statusBarHeight
				//#ifdef MP-WEIXIN
				menuButtonObject = uni.getMenuButtonBoundingClientRect()
				menuHeight = menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2
				navheight = menuHeight + statusBarHeight
				btnHeight = menuButtonObject.height
				btnWidth = menuButtonObject.width
				//#endif
				//#ifdef H5
				menuHeight = 44
				navheight = menuHeight + statusBarHeight
				btnHeight = 30
				btnWidth = 70
				//#endif
				if (getCurrentPages().length === 1) { // 当只有一个页面时
					haveBack = false;
				} else {
					haveBack = true;
				}
				that.navheight = navheight
				that.statusBarHeight = statusBarHeight
				that.menuHeight = menuHeight
				that.haveBack = haveBack
			},
		},
		mounted() {
			const that = this
			this.getSysHeightInfo()
			//#ifdef H5
			window.onscroll = function() {
				var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
				if (scrollTop > 30) {
					that.isScroll = true
				} else {
					that.isScroll = false
				}
			}
			//#endif

		},
		onPageScroll(t) {

			t.scrollTop > 20 ? this.xiao = false : this.xiao = true;
			// t.scrollTop > 80 ? this.da = true : this.da = false;

		},
		watch: {
			scrollTop(newValue, oldValue) {
				//#ifdef MP-WEIXIN
				const that = this
				if (newValue > 1) {
					that.isScroll = true
				} else {
					that.isScroll = false
				}
				//#endif
			}
		}
	}
</script>

<style lang="scss">
	.nav2 {
		white-space: nowrap;
		position: relative;
		height: 80upx;
		// padding: 20upx 0;
	}
	.nav-item2 {
		display: inline-block;
		margin: 0 20rpx 0 0upx;
		text-align: center;
		transition: color 0.3s ease;
		color: #999999;
		font-size: 24rpx;
		padding:0rpx 40rpx;
		height: 76rpx;
		line-height: 76rpx;
		border-radius: 10rpx;
		background: none;
	}
	.nav-item-act2 {
		color:#333333;
		background-color: #fff;
	}
	.scroll-h3 {
		width: 100%;
		/* // height: 100rpx; */
		// margin-top: 20rpx;
		box-sizing: border-box;
		// padding-left: 24rpx;
		flex-direction: row;
		/* #ifndef APP-PLUS */
		white-space: nowrap;
		/* #endif */
		/* flex-wrap: nowrap; */
		/* border-color: #cccccc;
		border-bottom-style: solid;
		border-bottom-width: 1px; */
	}
	.uni-tab-item3 {
		/* #ifndef APP-PLUS */
		display: inline-block;
		/* #endif */
		flex-wrap: nowrap;
		// padding-left: 20rpx;
		// padding-right: 20rpx;
		padding: 16rpx;
		margin-right: 10rpx;
		border-radius: 18rpx;
	}
	// 找货
	.jtb_active{
		background: #fff;
	}
	.jtb_as{
		background: none;
	}
	.yichu{
		width: 120rpx;
		height: 50rpx;
		background: #D9D9D9;
		border-radius: 50rpx;
		text-align: center;
		line-height: 50rpx;
		float: right;
		font-size: 24rpx;
		color: #646566;
		margin-top: 36rpx;
		// font-weight: 600;
	}
	.yichu1{
		width: 120rpx;
		height: 50rpx;
		background: #1FB0AC;
		border-radius: 25rpx;
		text-align: center;
		line-height: 50rpx;
		float: right;
		font-size: 24rpx;
		color: #ffffff;
		margin-top: 36rpx;
		// font-weight: 600;
	}
	.yichu2{
		width: 150rpx;
		height: 50rpx;
		background: #1FB0AC;
		border-radius: 25rpx;
		text-align: center;
		line-height: 50rpx;
		float: right;
		font-size: 24rpx;
		color: #ffffff;
		margin-top: 40rpx;
		// font-weight: 600;
	}
	.yichu3{
		width: 150rpx;
		height: 50rpx;
		background: #1FB0AC;
		border-radius: 25rpx;
		text-align: center;
		line-height: 50rpx;

		font-size: 24rpx;
		color: #ffffff;
		position: absolute;
		top: 50%;
		right: 30rpx;
		transform: translateY(-50%);
		// margin-top: 40rpx;
		// font-weight: 600;
	}
	.jian{
		padding: 0 32rpx;
		height: 80rpx;
		background: linear-gradient(0deg, #fff 0%, #fff 100%);
		border-radius: 40rpx;
		line-height: 80rpx;
		text-align: center;
		color: #1FB0AC;
		font-size: 28rpx;
		margin-left: 20rpx;
	}
	.bg{
		width: 100%;
	}
	page{
		background-color: #F8F8F8!important;
		font-family: Demibold;
	}
	.sou {
		width: 100%;
		height: 80rpx;
		line-height: 80rpx;
		border-radius: 40rpx;
		color: #FFFFFF;
		font-size: 26rpx;
		box-sizing: border-box;
		padding: 0 30rpx 0 80rpx;
		background-color: rgba(255,255,255,.3);
	}
	.souicon {
		width: 30rpx;
		height: 30rpx;
		position: absolute;
		top: 50%;
		left: 30rpx;
		transform: translateY(-50%);

	}
	.suo {
		color: #FFFFFF;
		opacity: 1;
		font-size: 26rpx;
	}
	.shang_city{
		width: calc(100vw - 60rpx);
		margin: 0 auto;
		box-sizing: border-box;
		padding-bottom: 200rpx;
		z-index: 11;
	}
	.pan_active{
		color: #fff;
		font-size: 36rpx;
		opacity: 1;
	}
	.pan_as{
		color: #fff;
		font-size: 28rpx;
		opacity: 0.6;
	}
	.pan_active::after {
		content: "";
		position: absolute;
		left: 50%;
		bottom:0rpx;
		right: 0;
		width: 60rpx;
		height: 6rpx;
		border-radius: 3rpx;
		background: #FFFFFF;
		transform: translateX(-50%);
	}
	.hai{
		text-align: center;
		font-size: 30rpx;
		color: #FFFFFF;
	}







	// 头部
	.navbar {
		width: 100%;
		overflow: hidden;
		top: 0;
		left: 0;
		z-index: 999;
		flex-shrink: 0;
		color: #fff;
		font-size: 16px;
	}

	.nav-normal {
		position: relative;
	}

	.nav-fixed {
		position: fixed;
	}

	.logo-centent {
		display: flex;
		align-items: center;
	}

	.logo-centent image {
		width: 260rpx;
		height: 68rpx;
		margin-left: 20rpx;
	}

	.hearder-status {
		display: flex;
		align-items: center;
		position: absolute;
		padding-left: 30rpx;
		height: 100%;
		z-index: 99999;

	}

	.header-title {
		height: 100%;
		left: 0;
		right: 0;
		position: absolute;
		margin: auto;
		text-align: center;
	}
	.header-title image{
		position: absolute;
		width:270rpx;
		height: 35rpx;
		top: 50%;
		left: 50%;
		transform: translate(-50%,-50%);
	}

	.header-title-left {
		height: 100%;
		left: 0;
		right: 0;
		position: absolute;
		margin: auto;
		text-align: left;
	}

	.back-text {
		margin-left: 7px;
		width: 100upx;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
	}

	.hearder-status .nav-title-left {
		display: flex;
		justify-content: space-between;
		align-items: center;
		color: rgba(0, 0, 0, .8);
		width: 100%;
		font-weight: bold;
	}
	.hearder-status .nav-btn {
		/* background-color: rgba(255, 255, 255, .5);
		border-radius: 15px; */
		display: flex;
		justify-content: space-between;
		align-items: center;
		color: rgba(0, 0, 0, .8);
		width: 50%;
		font-weight: bold;
	}

	.hearder-status .nav-btn .gotback,
	.hearder-status .nav-btn .gothome {
		flex: 1;
		text-align: center;
		font-size: 18px;
	}
	.Addslot {
		position: absolute;
		width: 100%;
	}
</style>